package com.example.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author krystal
 * @date 2023/3/7 19:39
 */
@RequestMapping("/user")
@Controller
@ResponseBody  //用来设置当前类中所有的方法返回的是数据而非页面
public class UserController {
    //1、得到日志对象
    private static final Logger logger= LoggerFactory.getLogger(UserController.class);

    @RequestMapping("/hi")
    public String sayHi(){

        //写日志
        logger.trace("我是trace");
        logger.debug("我是debug");
        logger.info("我是info");
        logger.warn("我是warn");
        logger.error("我是error");
        return "hi,Spring Boot";
    }
}
